You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Validate CLI execution_config before creating a run - #425
POST /test_run_executions/cli stored execution_config without validating it, unlike project create/update. A typo or wrong type in a th-cli run-tests --config file was only found after the run started.
Change
Extract the project validation into crud_project.validate_config() and reuse it in crud_project.create/update.
In create_cli_test_run_execution, validate execution_config (when provided) before the CLI project or the execution is created. A TestEnvironmentConfigError is returned as 422 with the message as detail.
Tests
Invalid config returns 422 and creates no project or execution.
Absent config is not validated.
Existing tests with a valid config cover the success path.
Not run locally (needs the Docker/DB dev environment).
CLI side: no code change needed (a 422 is already reported as APIError); regression test in the paired CLI PR.
create_cli_test_run_execution stored execution_config without validating
it, so a typo or wrong type was only found after the run started. Extract
the project validation into crud_project.validate_config and call it
before any project or execution is created, returning 422 on failure.
Auto reviews are disabled on base/target branches other than the default branch.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 909561d4-e291-4a5a-9d02-cece22c53a07
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
Walkthrough
The change adds a shared configuration validator and uses it for project creation, project updates, and CLI test-run executions. When a supplied CLI execution_config fails validation, the endpoint returns HTTP 422 before retrieving or creating a project. Tests cover invalid and absent execution configurations.
The new CLI config validation looks correct, but one of its added tests builds an invalid mock response and fails CI. Fix the test fixture so the backend test suite passes before merging.
Pre-merge checks: 3 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Linked Issues check
Backend requirements of #1210 are addressed. The change in test_run_executions.py validates execution_config when it is provided, before the CLI project or execution is created. TestEnvironmentConfigE…
Confirm in this repository that the th_cli error path converts an HTTP 422 response from POST /test_run_executions/cli into a CLIError (or equivalent) before any SDK container starts. Confirm that a CLI test for this path exists at the revi…
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title names the main change: the CLI test-run endpoint now validates execution_config before a run or project is created. It matches the raw summary, the PR description, and the objectives.
Description check
The description states the problem (execution_config was stored without validation), the change (shared validate_config helper, 422 on TestEnvironmentConfigError), and the tests. This matches the chan…
Out of Scope Changes check
All changed areas connect to #1210. The changes are: (1) the CLI endpoint validation and 422 mapping in app/api/api_v1/endpoints/test_run_executions.py; (2) extraction of validate_config() in app/crud…
Full details: Description check
Explanation
The description states the problem (execution_config was stored without validation), the change (shared validate_config helper, 422 on TestEnvironmentConfigError), and the tests. This matches the changeset.
Full details: Out of Scope Changes check
Explanation
All changed areas connect to #1210. The changes are: (1) the CLI endpoint validation and 422 mapping in app/api/api_v1/endpoints/test_run_executions.py; (2) extraction of validate_config() in app/crud/crud_project.py, reused by create and update, which the issue suggests as the shared validation helper; (3) backend tests for invalid and absent execution_config in app/tests/api/api_v1/test_test_run_executions.py. The refactor of project create and update is limited to replacing inline validation with the shared helper. It supports the issue approach and does not change unrelated behavior, based on the summary. No unrelated change was found.
Full details: Linked Issues check
Explanation
Backend requirements of #1210 are addressed. The change in test_run_executions.py validates execution_config when it is provided, before the CLI project or execution is created. TestEnvironmentConfigError maps to HTTP 422 with the message as detail. crud_project.validate_config() is shared with create and update. Tests cover invalid config (422, no project or execution created) and absent config (no validation). Valid config is covered by existing success-path tests. These results come from the PR summary and the PR description. Source inspection did not confirm them. The issue also requires that the CLI surfaces the error as a CLIError before any test starts, and that CLI test coverage exists. The PR states that no CLI change is needed because a 422 is already reported as APIError, and that the regression test is in a paired CLI PR. That paired PR is not part of this review. The CLI behavior is therefore not established by evidence in this PR. Related pull requests do not establish included work.
Resolution
Confirm in this repository that the th_cli error path converts an HTTP 422 response from POST /test_run_executions/cli into a CLIError (or equivalent) before any SDK container starts. Confirm that a CLI test for this path exists at the reviewed head or is included in this PR. If the paired CLI PR is the only location for that test, the issue reviewer must accept that split scope. Confirm the backend tests run and pass, because the PR states they were not run locally.
Finishing Touches
Fix failing CI checks
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 10c2fdb7-6e79-4d4d-a2cd-0270dfc444b7
Commits
Reviewing files that changed from the base of the PR and between 89cb842 and a6f5fa0.
Files selected for processing: 3
app/api/api_v1/endpoints/test_run_executions.py
app/crud/crud_project.py
app/tests/api/api_v1/test_test_run_executions.py
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Major · Functional Correctness · Quick win
Return a response-valid execution from this mock.
MagicMock() does not satisfy TestRunExecutionWithChildren. The supplied CI reports six response validation errors, so client.post() raises before the call assertions run. This fails the backend test command.
Return a valid execution fixture, as the neighboring success test does. Also assert HTTP 200 to confirm that the absent-config request completes successfully.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1210
Problem
POST /test_run_executions/clistoredexecution_configwithout validating it, unlike project create/update. A typo or wrong type in ath-cli run-tests --configfile was only found after the run started.Change
crud_project.validate_config()and reuse it incrud_project.create/update.create_cli_test_run_execution, validateexecution_config(when provided) before the CLI project or the execution is created. ATestEnvironmentConfigErroris returned as422with the message asdetail.Tests
Not run locally (needs the Docker/DB dev environment).
CLI side: no code change needed (a 422 is already reported as
APIError); regression test in the paired CLI PR.